package com.gitee.wsl.doc.prosemirror.model.util

import com.fleeksoft.ksoup.nodes.Node as DOMNode



fun DOMNode.contains(node: DOMNode) = isInclusiveAncestor(this, node)

private fun isInclusiveAncestor(parent: DOMNode, node: DOMNode): Boolean {
    var current: DOMNode? = node
    while (current != null) {
        if (current == parent) return true
        current = current.parent()
    }
    return false
}
